# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Thayne <astrothayne at gmail dot com>
# Contributor: Yiqiao Wang <yiqiao.wang96 at gmail dot com>
# Contributor: wenLiangcan <boxeed at gmail dot com>

pkgname=ammonite
pkgver=2.5.8
_commit=5f36c7bddc98a389cc2e4d80ff2670463e11f892
_scalaversion=2.13.2
pkgrel=1
pkgdesc="A cleanroom re-implementation of the Scala REPL from first principles. "
arch=('any')
url="https://github.com/lihaoyi/Ammonite"
license=('MIT')
depends=('bash' 'java-environment')
makedepends=('git' 'mill')
source=("git+https://github.com/lihaoyi/Ammonite.git#commit=$_commit")
b2sums=('SKIP')

build() {
  cd Ammonite
  mill -i amm[$_scalaversion].assembly
}

package() {
  cd Ammonite
  install -dm755 "$pkgdir"/usr/bin
  (echo "#!/bin/sh"; cat out/amm/$_scalaversion/assembly.dest/out.jar) > "$pkgdir"/usr/bin/amm
  chmod +x "$pkgdir"/usr/bin/amm
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
